﻿#include "FITKAbaHistoryOutput.h"
#include "FITKAbaOutputDefaultVariablesManager.h"


Interface::FITKAbaHistoryOutput::FITKAbaHistoryOutput()
{
    m_data.setOutputFrequency(FITKAbaOutputVariable::OutputFrequency::EvertyNIncreaments);
    m_data.setIntervals(200);
}

Interface::FITKAbaAbstractOutput::FITKAbaOutputType Interface::FITKAbaHistoryOutput::getOutputType() const
{
    return FITKAbaOutputType::History;
}

QVector<QVector<QString> > Interface::FITKAbaHistoryOutput::getAllVariablesWithParents(FITKAbaAbstractStep::FITKAbaStepType stepType,
    FITKAbaOutputVariable::OutputDomain domain)
{
    QVector<QVector<QString>> vars{};
    QStringList allVars = FITKAbaOutputDefaultVariablesManager::getInstance()->getAllDefaultHistoryVariables(stepType, domain);
    for (const QString& var : allVars)
    {
        QStringList parents = FITKAbaOutputVariable::getVariableParents(var);
        QVector<QString> vStrs{var,};
        for (const QString& parent : parents)
        {
            vStrs.push_front(parent);
        }
        vars.push_back(vStrs);
    }
    return vars;
}

QStringList Interface::FITKAbaHistoryOutput::getAllVariables(FITKAbaAbstractStep::FITKAbaStepType stepType,
    FITKAbaOutputVariable::OutputDomain domain)
{
    QStringList allVars = FITKAbaOutputDefaultVariablesManager::getInstance()->getAllDefaultHistoryVariables(stepType, domain);
    return allVars;
}

QStringList Interface::FITKAbaHistoryOutput::getPreselectedVariables(FITKAbaAbstractStep::FITKAbaStepType stepType, 
    FITKAbaOutputVariable::OutputDomain domain)
{
    QStringList allVars = FITKAbaOutputDefaultVariablesManager::getInstance()->getPreSelectedDefaultHistoryVariables(stepType, domain);
    return allVars;
}

QString Interface::FITKAbaHistoryOutput::getVariableDescription(const QString &var)
{
    return FITKAbaOutputVariable::getVariableDescription(var);
}
